]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
PopupMenuManager: Close active menu when another one opens
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 26 Apr 2013 15:06:22 +0000 (17:06 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 26 Apr 2013 15:50:06 +0000 (17:50 +0200)
We already do this when navigating between menus via mouse or
keynav, but miss cases where a menu is opened by other means,
for instance via a keyboard shortcut.

https://bugzilla.gnome.org/show_bug.cgi?id=686756

js/ui/popupMenu.js

index a7644d952df8357ffb3fa87f1e9219f1d21174cd..cd81f10792001af6c937888782914e058f716ce6 100644 (file)
@@ -2049,6 +2049,8 @@ const PopupMenuManager = new Lang.Class({
 
     _onMenuOpenState: function(menu, open) {
         if (open) {
+            if (this.activeMenu)
+                this.activeMenu.close(BoxPointer.PopupAnimation.FADE);
             this._grabHelper.grab({ actor: menu.actor, modal: true, focus: menu.sourceActor,
                                     onUngrab: Lang.bind(this, this._closeMenu, menu) });
         } else {
@@ -2065,13 +2067,8 @@ const PopupMenuManager = new Lang.Class({
     },
 
     _changeMenu: function(newMenu) {
-        let oldMenu = this.activeMenu;
-        if (oldMenu) {
-            oldMenu.close(BoxPointer.PopupAnimation.FADE);
-            newMenu.open(BoxPointer.PopupAnimation.FADE);
-        } else {
-            newMenu.open(BoxPointer.PopupAnimation.FULL);
-        }
+        newMenu.open(this.activeMenu ? BoxPointer.PopupAnimation.FADE
+                                     : BoxPointer.PopupAnimation.FULL);
     },
 
     _onMenuSourceEnter: function(menu) {